package com.tywj.panda.home.notice

import androidx.core.text.HtmlCompat

import com.tywj.panda.customer.common.widget.recyclerview.MyBaseAdapter
import com.tywj.panda.home.R
import com.tywj.panda.home.entity.NoticeEntity
import com.tywj.lib.core.widget.recycleview.adapter.BaseViewHolder
import com.tywj.panda.customer.common.tool.TimeTool

/**
 * @desc 通知消息适配器
 * @author June Yang
 * @date 2020/5/27
 */
class NoticeAdapter : MyBaseAdapter<NoticeEntity.DataBean>(R.layout.item_notice) {

    override fun convert(helper: BaseViewHolder, item: NoticeEntity.DataBean) {
        super.convert(helper, item)

        helper.setText(R.id.tvTitle, item.title)
        helper.setText(R.id.tvTime, TimeTool.formatTime1(item.createDate))

        helper.setGone(R.id.redCircle, item.read == 0)
        helper.setText(
            R.id.tvContent,
            HtmlCompat.fromHtml(item.content, HtmlCompat.FROM_HTML_MODE_COMPACT)
        )
    }
}